package com.common.utils;

/**
 * author : Administrator
 * e-mail : 254419013@qq.com
 * time   : 2017/04/24
 * desc   :
 */
public class CodeBetweenRunTimeUtil {

    private volatile long start;

    private volatile long end;

    private static class LazyHolder {
        private static final CodeBetweenRunTimeUtil INSTANCE = new CodeBetweenRunTimeUtil();
    }

    private CodeBetweenRunTimeUtil() {

    }

    public static CodeBetweenRunTimeUtil instance() {
        return CodeBetweenRunTimeUtil.LazyHolder.INSTANCE;
    }


    public void setStartTime() {
        start = System.currentTimeMillis(); //获取开始时间
        System.out.println("程序开始运行：" + start + " ms");
    }

    public void getBetweenTime() {
        end = System.currentTimeMillis(); //获取开始时间
        System.out.println("程序结束运行：" + end + " ms");
        System.out.println("程序结束运行时间： " + (end - start) + "ms");
    }
}
